package com.example.tuter.activity;

import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.example.tuter.R;
import com.example.tuter.adapter.ReactAdapter;
import com.example.tuter.entity.Post;

//点击通知会跳转到该页面
public class NotificationReactActivity extends AppCompatActivity {

    String TAG = NotificationReactActivity.class.getSimpleName();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Window window = getWindow();
        window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
        window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
        window.setStatusBarColor(Color.TRANSPARENT);


        Intent intent = getIntent();
        setIntent(intent);
        setContentView(R.layout.activity_react);
        Post post = (Post) intent.getSerializableExtra("post");
        //这里应该是有分类，有adapter





        RecyclerView recyclerView = findViewById(R.id.react_recyclerview);
        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);

        ReactAdapter reactAdapter = new ReactAdapter(post, this);

        recyclerView.setLayoutManager(linearLayoutManager);
        recyclerView.setAdapter(reactAdapter);

        //点击事件绑定：跳转到具体的post中
        reactAdapter.setRecyclerItemClickListener(new ReactAdapter.OnRecyclerItemClickListener() {
            @Override
            public void onRecyclerItemClick(int position) {

                Intent intent = new Intent(NotificationReactActivity.this, ViewPostActivity.class);
                //传输post信息，以及notification信息
//                intent.putExtra("post")
                startActivity(intent);
            }
        });
    }






}
